package com.yc.web.actions;

import java.util.UUID;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.yc.bean.Person;
import com.yc.biz.PersonBiz;



@Controller
public class PersonAction extends ActionSupport {
	
	
	@Resource(name="personBiz")
	public PersonBiz personBiz;
	
	private Person person;
	
	
	@Action(value="/person_add",
			results={@Result(name="success", location="/success.jsp"),
			@Result(name="error", location="/index.jsp")})
	public String add(){
		person.setPid(UUID.randomUUID().toString());
		personBiz.addPerson(person);
		return "success";
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public void setPersonBiz(PersonBiz personBiz) {
		this.personBiz = personBiz;
	}
	
	
	
	
}
